******************************************************************
* Varieties of Economic Vulnerability  				 			 *
* Melina Altamirano, Sarah Berens & Franziska Deeg 	 			 *
* March 2021         											 *
* Descriptives										 *
******************************************************************

use MEX_survey_RF_Vulnerabilities_AltamiranoEtAl2021.dta, clear 

***************
* Figure 1: DV overview
***************
hist pension, percent discrete xlabel(1"Disagree" 2"Somewhat disagree" 3"Somewhat agree" 4"Agree", labsize(small) alternate)
graph save Figures/Fig4b.gph, replace
hist health , percent discrete xlabel(1"Disagree" 2"Somewhat disagree" 3"Somewhat agree" 4"Agree", labsize(small) alternate) 
graph save Figures/Fig4c.gph, replace
hist prospera , percent discrete xlabel(1"Disagree" 2"Somewhat disagree" 3"Somewhat agree" 4"Agree", labsize(small) alternate) 
graph save Figures/Fig4e.gph, replace
hist prog_tax , percent discrete xlabel(1"(33/33/33)"  2"(40/30/30)" 3"(50/30/20)"  , labsize(small) alternate) 
graph save Figures/Fig4f.gph, replace

graph combine  Figures/Fig4b.gph Figures/Fig4c.gph  Figures/Fig4e.gph Figures/Fig4f.gph, row(2)
graph save Figures/Figure1.gph, replace
graph export Figures/Figure1.pdf, as(pdf) replace

***************
* Figure 2: IV overview: formal and informal workers
***************

hist light_formalv2, percent discrete addlabels ylabel(0(20)80) xlabel(1"Formal" 0"Informal" , labsize(small) ) note("N=802")
graph save Figures/Fig5a.gph, replace

hist household4, percent discrete addlabels ylabel(0(20)80) xlabel(1"InformalHH" 2"FormalHH" 3"MixedHH, formal Resp." 4"MixedHH, informal Resp.", labsize(small) ) note("N= 651")
graph save Figures/Fig5b.gph, replace

hist fortoinf, percent discrete addlabels ylabel(0(20)80) xlabel(1"Formal_Informal" 0"StayFormal" , labsize(small) ) note("N= 241")
graph save Figures/Fig5c.gph, replace

hist inftofor, percent discrete addlabels ylabel(0(20)80)  xlabel(1"Informal_Formal" 0"StayInformal" , labsize(small) ) note("N= 513")
graph save Figures/Fig5d.gph, replace


graph combine Figures/Fig5a.gph Figures/Fig5b.gph Figures/Fig5c.gph Figures/Fig5d.gph, row(2)
graph save Figures/Figure2.gph, replace
graph export Figures/Figure2.pdf, as(pdf) replace

***************
* Table A: Descriptives
***************

eststo clear 

estpost sum pension health prospera prog_tax light_formalv2 labor_force3 labor_force fortoinf inftofor household4 secure_lmhistory age female resp_edu inc_amain dependants corr_perception union_memb job_insecurity CCT_receive vote_choice urban state      
estimates store M2

esttab M2 using Tables/TableA_Appendix.tex, replace cells("mean sd min max sum_w") label nodepvar title("Descriptive Statistics")  

summarize i.household4
summarize i.vote_choice




